var e = require("../../../@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
  value: !0
}), exports.cleanCardData = function (e) {
  return i.apply(this, arguments)
};
var t = require("../../../@babel/runtime/helpers/regeneratorRuntime"),
  a = require("../../../@babel/runtime/helpers/asyncToGenerator"),
  l = e(require("../../../lib/dayjs/index")),
  u = require("../../../config/index"),
  r = [{
    key: u.typeMode.hire,
    value: "出租",
    tagType: "unique"
  }, {
    key: u.typeMode.sell,
    value: "出售",
    tagType: "unique"
  }, {
    key: u.typeMode.seeking,
    value: "求租",
    tagType: "primary"
  }, {
    key: u.typeMode.askBuy,
    value: "求购",
    tagType: "primary"
  }, {
    key: u.typeMode.recruit,
    value: "招工",
    tagType: "primary"
  }, {
    key: u.typeMode.complain,
    value: "黑老板",
    tagType: "primary"
  }, {
    key: u.typeMode.device,
    value: "设备",
    tagType: "unique"
  }];

function o(e) {
  var t = (new Date).getTime() / 1e3 - e,
    a = 1e3 * e;
  return t < 7200 ? "刚刚" : t < 86400 ? (0, l.default)(a).format("HH:mm") : t < 31536e3 ? (0, l.default)(a).format("MM-DD") : (0, l.default)(a).format("YYYY-MM-DD")
}

function i() {
  return (i = a(t().mark((function e(a) {
    var i, d, s, p, c, v, g, b, m;
    return t().wrap((function (e) {
      for (;;) switch (e.prev = e.next) {
        case 0:
          d = null == a ? void 0 : a.cover, s = -1 != [u.typeMode.hire, u.typeMode.sell, u.typeMode.device].indexOf(Number(null == a ? void 0 : a.mode)), p = null != a && a.timestamp ? o(null == a ? void 0 : a.timestamp) : "", c = {
            cardType: d && s ? "unique" : "base",
            cover: null == a ? void 0 : a.cover,
            title: null == a ? void 0 : a.title,
            titleTagData: [].concat((null == a ? void 0 : a.titleTag) || []),
            tagData: [],
            area: null == a ? void 0 : a.area,
            time: null != a && a.timestamp ? (0, l.default)(1e3 * a.timestamp).format("MM月DD日 HH:mm") : "",
            timeText: p,
            statusTagText: "",
            isBrowse: a.isBrowse
          }, -1 !== (v = null == r ? void 0 : r.findIndex((function (e) {
            return e.key == (null == a ? void 0 : a.mode)
          }))) && this.data.showTitleTag && c.titleTagData.push({
            title: r[v].value,
            type: r[v].tagType
          }), null != a && a.getPhone || null != a && a.get_phone ? c.titleTagData.push({
            title: "已看",
            type: "disable"
          }) : null != a && a.top && c.titleTagData.push({
            title: "置顶",
            type: "danger"
          }), "2" == a.status && a.mode != u.typeMode.device && (g = u.tagStatusList[Number(a.mode)][2], c.statusTagText = g), null != a && a.top && c.tagData.push({
            title: "免费拨打",
            bgColor: "#ecfbf1",
            color: "#46db7a"
          }), 2 == Number(null == a ? void 0 : a.company_status) && c.tagData.push({
            title: "供应商",
            bgColor: "rgba(255, 240, 217, 1)",
            color: "rgba(255, 91, 3, 1)"
          }), "browsing" === this.data.type && (c.time += "浏览过"), Object.keys((null == a ? void 0 : a.labels) || {}).forEach((function (e) {
            "address" === e && (c.area = a.labels[e].value), "rent_price" !== e && "sold_price" !== e || (null == a ? void 0 : a.mode) != u.typeMode.device && c.tagData.push({
              title: a.labels[e].value,
              bgColor: "rgba(255, 240, 217, 1)",
              color: "rgba(255, 137, 3, 1)"
            })
          })), (null == a ? void 0 : a.mode) == u.typeMode.device && n(a.use_type, null === (b = a.labels) || void 0 === b ? void 0 : b.rent_price, null === (m = a.labels) || void 0 === m ? void 0 : m.sold_price, c), null == a || null === (i = a.class) || void 0 === i || i.forEach((function (e) {
            c.tagData.push({
              title: e.name
            })
          })), Object.keys((null == a ? void 0 : a.labels) || {}).forEach((function (e) {
            -1 !== ["manufacture_date", "worked_hour", "rent_days", "brand_name", "model_name", "manufacture_limit", "wanted_num"].indexOf(e) && c.tagData.push({
              title: a.labels[e].value
            })
          })), this.setData({
            cardItem: c
          });
        case 3:
        case "end":
          return e.stop()
      }
    }), e, this)
  })))).apply(this, arguments)
}
var n = function (e, t, a, l) {
  3 == e ? null != t && t.value || null != a && a.value ? (l.tagData.push({
    title: null != t && t.value ? "出租".concat(null == t ? void 0 : t.value) : "出租面议",
    bgColor: "rgba(255, 240, 217, 1)",
    color: "rgba(255, 137, 3, 1)"
  }), l.tagData.push({
    title: null != a && a.value ? "出售".concat(null == a ? void 0 : a.value) : "出售面议",
    bgColor: "rgba(255, 240, 217, 1)",
    color: "rgba(255, 137, 3, 1)"
  })) : l.tagData.push({
    title: "面议",
    bgColor: "rgba(255, 240, 217, 1)",
    color: "rgba(255, 137, 3, 1)"
  }) : 2 == e ? l.tagData.push({
    title: null != a && a.value ? "出售".concat(null == a ? void 0 : a.value) : "面议",
    bgColor: "rgba(255, 240, 217, 1)",
    color: "rgba(255, 137, 3, 1)"
  }) : l.tagData.push({
    title: null != t && t.value ? "出租".concat(null == t ? void 0 : t.value) : "面议",
    bgColor: "rgba(255, 240, 217, 1)",
    color: "rgba(255, 137, 3, 1)"
  })
};